Repository navigation
New test tools - #622
Merged
Merged
New test tools#622
Conversation
As a part of the Markdown lib, test tools can be used by third party extensions. Also keeps test dir clean as it only contains actual tests. More work in this vein to come as the need for Nose is removed. Tests are defined as Unittests rather than in text files allowing features to be more easily broken into units and run individually. Based completely on standard lib unittest with no external dependencies. Use `python -m unittest tests.test_syntax` to run. Pulled some tests from https://github.com/karlcow/markdown-testsuite. Many more test units to pull from that source. As we encounter the need to edit an existing textfile-based test, or add a new test, a new test should be created with this framework and the old test should be deleted. Also need to delete existing testfile-based tests which are covered in the new tests included here.
waylan
force-pushed
the
newtests
branch
2 times, most recently
from
January 7, 2018 00:16
d804c84 to
c7a23ff
Compare
Member
Author
|
Hmm, it seems that Travis has had a lot of jobs time-out recently. Usually it is somewhere in the setup process (downloading deps or similar). If I restart them they run fine. Anyone else seeing that? |
Collaborator
|
Yes. Right around the new year, Travis went to crap. It's been timeouts since on multiple of my repos. So it's not specific to this repo. |
All file-based tests are now defined as unittest test cases via a metaclass which walks a directory and builds a unittest for each pair of test files. To run the tests just run `python -m unittest discover tests`. Or use tox as the tox config has been updated to run the new tests and all nose specific code has been removed. The test generator tools have been removed as well. If any changes or additions need to be made to tests, they should be implemented using the new framework rather than with the file-based tests. Eventually, only the PHP and pl tests should remain as file-based tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The new test tools are designed to both be used by Python-Markdown and by third party extensions. As all tests are based on the Python standard lib
unittest, no third party dependencies exist (we no longer rely onnose). See the included documentation for the details.The following is my proposal for how we should proceed with Python-Markdown's tests going forward:
Any new syntax tests for Python-Markdown should be developed with the
markdown.test_tools.TestCaseclass. Any old file-based tests which need updating should be converted to this new type of test. A few new tests have been included with this PR and can be found in thetests/test_syntaxdirectory. That directory should contain two subdirs:blockandinline. Theblocksubdir should contain files of tests for block-level elements and theinlinesubdir should contain files of tests for inline-level elements. Each file should contain tests for a single type of element.The old file-based tests still exist but are now wrapped in
markdown.test_tools.LegacyTestCaseclass instances. All of the wrapping classes, which include all of the settings and config for each tests are contained in thetests/test_legacy.pyfile. Over time, as these tests get moved to the new format, they should be removed from the legacy tests (none have been removed yet). Eventually, only the Perl and PHP test suites should remain (no edits should happen to those test files; if a test won't pass for good reason, then it should be skipped as some already are).Any and all feedback is welcome.